﻿using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

// Token: 0x020003BF RID: 959
[RequireComponent(typeof(Toggle))]
public class ThumbnailSelectCell : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IEventSystemHandler
{
	// Token: 0x060017E2 RID: 6114 RVA: 0x0009CE58 File Offset: 0x0009B058
	private void Awake()
	{
		this.toggle = base.GetComponent<Toggle>();
	}

	// Token: 0x060017E3 RID: 6115 RVA: 0x0009CE68 File Offset: 0x0009B068
	public void Setup(ThumbnailSelectUI owner, int id, string name, Sprite sprite, bool isNew)
	{
		this.owner = owner;
		this.image.sprite = sprite;
		this.id = id;
		if (this.nameText != null)
		{
			this.nameText.text = name;
		}
		this.newImg.gameObject.SetActive(isNew);
		this.image.enabled = (sprite != null);
	}

	// Token: 0x060017E4 RID: 6116 RVA: 0x0009CED4 File Offset: 0x0009B0D4
	private void OnEnable()
	{
		this.OnCursorExit();
	}

	// Token: 0x060017E5 RID: 6117 RVA: 0x0009CEDC File Offset: 0x0009B0DC
	private void OnDisable()
	{
		this.OnCursorExit();
	}

	// Token: 0x060017E6 RID: 6118 RVA: 0x0009CEE4 File Offset: 0x0009B0E4
	public void OnPointerEnter(PointerEventData data)
	{
		this.OnCursorEnter();
	}

	// Token: 0x060017E7 RID: 6119 RVA: 0x0009CEEC File Offset: 0x0009B0EC
	public void OnPointerExit(PointerEventData data)
	{
		this.OnCursorExit();
	}

	// Token: 0x060017E8 RID: 6120 RVA: 0x0009CEF4 File Offset: 0x0009B0F4
	public void OnToggleValueChange(bool isOn)
	{
		if (isOn)
		{
			this.owner.OnSelect(this.id);
		}
	}

	// Token: 0x060017E9 RID: 6121 RVA: 0x0009CF10 File Offset: 0x0009B110
	private void OnCursorEnter()
	{
		if (this.owner != null)
		{
			this.owner.OnEnterCell(this.id);
		}
	}

	// Token: 0x060017EA RID: 6122 RVA: 0x0009CF34 File Offset: 0x0009B134
	private void OnCursorExit()
	{
		if (this.owner != null)
		{
			this.owner.OnExitCell(this.id);
		}
	}

	// Token: 0x060017EB RID: 6123 RVA: 0x0009CF58 File Offset: 0x0009B158
	public void SetToggle(bool isOn)
	{
		this.toggle.isOn = isOn;
	}

	// Token: 0x060017EC RID: 6124 RVA: 0x0009CF68 File Offset: 0x0009B168
	public void SetInteractable(bool flag)
	{
		this.toggle.interactable = flag;
	}

	// Token: 0x04001B55 RID: 6997
	private ThumbnailSelectUI owner;

	// Token: 0x04001B56 RID: 6998
	[SerializeField]
	private Image image;

	// Token: 0x04001B57 RID: 6999
	[SerializeField]
	private Text nameText;

	// Token: 0x04001B58 RID: 7000
	[SerializeField]
	private Image newImg;

	// Token: 0x04001B59 RID: 7001
	private Toggle toggle;

	// Token: 0x04001B5A RID: 7002
	private int id;
}
